package com.loyal.kit.gson;

import com.google.gson.internal.$Gson$Types;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * Created by dim on 16/5/27.
 */
public class TypeFactory {

    public static Type list(Type type) {
        return $Gson$Types.newParameterizedTypeWithOwner(null, List.class, type);
    }

    public static Type set(Type type) {
        return $Gson$Types.newParameterizedTypeWithOwner(null, Set.class, type);
    }

    public static Type hashMap(Type type, Type type2) {
        return $Gson$Types.newParameterizedTypeWithOwner(null, HashMap.class, type, type2);
    }

    public static Type map(Type type, Type type2) {
        return $Gson$Types.newParameterizedTypeWithOwner(null, Map.class, type, type2);
    }

    public static Type parameterized(Type ownerType, Type rawType, Type... typeArguments) {
        return $Gson$Types.newParameterizedTypeWithOwner(ownerType, rawType, typeArguments);
    }

    public static Type array(Type type) {
        return $Gson$Types.arrayOf(type);
    }

    public static Type objList(Type pType, Type cType) {
        return $Gson$Types.newParameterizedTypeWithOwner(null, pType, List.class, cType);
    }

    public static Type subtypeOf(Type type) {
        return $Gson$Types.subtypeOf(type);
    }

    public static Type supertypeOf(Type type) {
        return $Gson$Types.supertypeOf(type);
    }
}